package com.jersey;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;

@XmlAccessorType(XmlAccessType.FIELD)
public class DealTableBean {
	public static final int PARAM_NAME_PAGE_SIZE = 25;
	
	private int totalCount;
	private int pageNum;
	@XmlElement(name = "deal")
	private List<DealBean> deals;
	
	
	
	public DealTableBean() {
		
	}
	
	public DealTableBean(List<DealBean> deals, int pageNum, int totalCount) {
		this.deals = deals;
		this.pageNum = pageNum;
		this.totalCount = totalCount;
	}
	/**
	 * @return the deals
	 */
	public List<DealBean> getDeals() {
		if(this.deals == null) {
			this.deals = new ArrayList<DealBean>(0);
		}
		return deals;
	}
	/**
	 * @param deals the deals to set
	 */
	public void setDeals(List<DealBean> deals) {
		this.deals = deals;
	}
	/**
	 * @return the pageNum
	 */
	public int getPageNum() {
		return pageNum;
	}
	/**
	 * @param pageNum the pageNum to set
	 */
	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}
	/**
	 * @return the totalCount
	 */
	public int getTotalCount() {
		return totalCount;
	}
	/**
	 * @param totalCount the totalCount to set
	 */
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}
	
	public int dealSize() {
		return this.getDeals().size();
	}
	
	public DealBean get(int index) {
		return getDeals().get(index);
	}
	
	public boolean hasDeal() {
		return getDeals().size() > 0;
	}
	
}
